#include <iostream>

struct BinaryTree
{
	BinaryTree(int n)
	{
		val = n;
		left = right = nullptr;
	}

	int val;
	BinaryTree* left;
	BinaryTree* right;
};

BinaryTree* BuyNode(int n)
{
	BinaryTree* tmp = new BinaryTree(n);
	return tmp;
}

BinaryTree* CreateBinaryTree(int n)
{
	BinaryTree* node1 = BuyNode(2);
	BinaryTree* node2 = BuyNode(2);
	BinaryTree* node3 = BuyNode(n);
	BinaryTree* node4 = BuyNode(2);
	BinaryTree* node5 = BuyNode(2);
	BinaryTree* node6 = BuyNode(2);

	node1->left = node2;
	node1->right = node4;
	node2->left = node3;
	node4->left = node5;
	node4->right = node6;

	return node1;
}